﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WinSPen.Objects
{
    /// <summary>
    /// WSPObject(WSPStroke, WSPText)의 ID를 생성하고 관리하는 클래스
    /// </summary>
    internal class ObjectIDProvider
    {
        private ObjectIDProvider() { }

        private static ObjectIDProvider _instance;

        public static ObjectIDProvider GetInstance()
        {
            if (_instance == null)
            {
                _instance = new ObjectIDProvider();
            }
            return _instance;
        }

        private int _localObjectID = -1;

        /// <summary>
        /// Local Object용 ID를 새로 생성한다.
        /// </summary>
        /// <returns></returns>
        public int GetNewLocalObjectID()
        {
            return ++this._localObjectID;
        }

        private int _networkObjectID = -1;

        /// <summary>
        /// Network Object용 ID를 새로 생성한다.
        /// </summary>
        /// <returns></returns>
        public int GetNewNetworkObjectID()
        {
            return ++this._networkObjectID;
        }
    }
}
